package util

type KubeType string

const (
	MASTER  KubeType = "in_master"
	CLUSTER KubeType = "in_cluster"
	CONFIG  KubeType = "in_config"
)

type KubeConfig struct {
	Type       KubeType `json:"type"`
	ConfigPath string   `json:"config_path,omitempty"`
}

func NewKubeConfig(typ KubeType, path string) *KubeConfig {
	k := &KubeConfig{}
	switch typ {
	case MASTER, CLUSTER:
		k.Type = typ
	case CONFIG:
		if len(path) == 0 {
			return nil
		}
		k.Type = typ
		k.ConfigPath = path
	default:
		return nil
	}
	return k
}
